package com.janke.softballnexus.client.events;

import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.web.bindery.requestfactory.shared.RequestContext;

public class DeleteAllDivisions extends GwtEvent<DeleteAllDivisions.Handler> {

	private final RequestContext request;

	public static Type<Handler> TYPE = new Type<Handler>();

	public interface Handler extends EventHandler {
		void deleteAllDivisions(RequestContext requestContext);
	}

	@Override
	public Type<Handler> getAssociatedType() {
		return TYPE;
	}

	@Override
	protected void dispatch(Handler handler) {
		handler.deleteAllDivisions(request);
	}

	public static void register(EventBus bus, Handler handler) {
		bus.addHandler(TYPE, handler);
	}

	public DeleteAllDivisions() {
		this(null);
	}

	public DeleteAllDivisions(RequestContext request) {
		this.request = request;
	}
}
